var wmsproxy = "./cgi-bin/arcgisproxy.php?";
//wmsproxy = "";

function OverlayWMS(wms)
{
	map.overlayMapTypes.insertAt(toplevel, wms.obj);
	toplevel++;
	wms_order.push(wms.name);
}
function RemoveWMS(wms)
{
	index = wms_order.indexOf(wms.name);
	map.overlayMapTypes.removeAt(index);
	toplevel--;
	ShiftArray(index);
}
function WMS_Call_Layers() {
	
	// TEMPLATE
	//var wmsOptions_waterquality = {
	//	alt : "MapServer Layer",
	//	getTileUrl : WMS_waterquality,			// ประกาศให้ตรงกับ function ที่จะต้องประกาศด้านท้ายของไฟล์นี้
	//	isPng : false,
	//	maxZoom : 17,
	//	minZoom : 1,
	//	tileSize : new google.maps.Size(256, 256)
	//};
	//wms_waterquality = new google.maps.ImageMapType(wmsOptions_waterquality);		// ชื่อในวงเล็บต้องใส่ให้ตรงกับ var wmsOption_XXX ที่ประกาศข้างบน
        var wmsOptions_crm1 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_crm1,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,	
		// name: "MapServer Layer",
		tileSize : new google.maps.Size(256, 256)
	};
	wms_crm1 = new google.maps.ImageMapType(wmsOptions_crm1);
        
        var wmsOptions_crm2 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_crm2,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,	
		// name: "MapServer Layer",
		tileSize : new google.maps.Size(256, 256)
	};
	wms_crm2 = new google.maps.ImageMapType(wmsOptions_crm2);
        
	var wmsOptions_crm3 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_crm3,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,	
		// name: "MapServer Layer",
		tileSize : new google.maps.Size(256, 256)
	};
	wms_crm3 = new google.maps.ImageMapType(wmsOptions_crm3);
        
        var wmsOptions_crm4 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_crm4,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,	
		// name: "MapServer Layer",
		tileSize : new google.maps.Size(256, 256)
	};
	wms_crm4 = new google.maps.ImageMapType(wmsOptions_crm4);
        
	var wmsOptions_waterquality = {
		alt : "MapServer Layer",
		getTileUrl : WMS_waterquality,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,	
		// name: "MapServer Layer",
		tileSize : new google.maps.Size(256, 256)
	};
	wms_waterquality = new google.maps.ImageMapType(wmsOptions_waterquality);
	
	var wmsOptions_Pipe_age_15 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Pipeline_age_15,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,			
			// name: "MapServer Layer",
			tileSize : new google.maps.Size(256, 256)
		};
	wms_Pipeline_age_15 = new google.maps.ImageMapType(wmsOptions_Pipe_age_15);
	
	var wmsOptions_Main_pipe_age_15 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Main_pipe_age_15,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,			
			// name: "MapServer Layer",
			tileSize : new google.maps.Size(256, 256)
		};
	wms_Main_pipe_age_15 = new google.maps.ImageMapType(wmsOptions_Main_pipe_age_15);
	
	var wmsOptions_pipe_AC_age_15 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Pipe_AC_age_15,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,			
			// name: "MapServer Layer",
			tileSize : new google.maps.Size(256, 256)
		};
	wms_pipe_AC_age_15 = new google.maps.ImageMapType(wmsOptions_pipe_AC_age_15);
	
	
	
	var wmsOptions_distribution_pipe_age_15 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_distribution_pipe_age_15,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,			
			// name: "MapServer Layer",
			tileSize : new google.maps.Size(256, 256)
		};
	wms_distribution_pipe_age_15 = new google.maps.ImageMapType(wmsOptions_distribution_pipe_age_15);
	
	var wmsOptions_effectivearea = {
		alt : "effective",
		getTileUrl : wms_effectivearea,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		// name: "MapServer Layer",
		tileSize : new google.maps.Size(256, 256)
	};
	wms_effectivearea = new google.maps.ImageMapType(wmsOptions_effectivearea);
        
	var wmsOptions_resource = {
		alt : "MapServer Layer",
		getTileUrl : WMS_resource,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.50,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_resource = new google.maps.ImageMapType(wmsOptions_resource);

	var wmsOptions_Customers_in_DMA = {
		alt : "MapServer Layer",
		getTileUrl : WMS_Customers_in_DMA,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.50,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsCustomers_in_DMA = new google.maps.ImageMapType(wmsOptions_Customers_in_DMA);

	var wmsOptions_Valve_in_DMA = {
		alt : "MapServer Layer",
		getTileUrl : WMS_Valve_in_DMA,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.50,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsValve_in_DMA = new google.maps.ImageMapType(wmsOptions_Valve_in_DMA);

	var wmsOptions_Trunkmain_leak_DMA = {
		alt : "MapServer Layer",
		getTileUrl : WMS_Trunkmain_leak_DMA,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.50,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsTrunkmain_leak_DMA = new google.maps.ImageMapType(wmsOptions_Trunkmain_leak_DMA);

	var wmsOptions_RepeatedFlood = {
		alt : "MapServer Layer",
		getTileUrl : WMS_RepeatedFlood,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.50,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsRepeatedFlood = new google.maps.ImageMapType(wmsOptions_RepeatedFlood);

	var wmsOptions_RepeatedDrought = {
		alt : "MapServer Layer",
		getTileUrl : WMS_RepeatedDrought,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsRepeatedDrought = new google.maps.ImageMapType(
			wmsOptions_RepeatedDrought);

	var wmsOptions_RiverBasin = {
		alt : "MapServer Layer",
		getTileUrl : WMS_RiverBasin,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.50,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsRiverBasin = new google.maps.ImageMapType(wmsOptions_RiverBasin);

	var wmsOptions_DataEarth = {
		alt : "MapServer Layer",
		getTileUrl : WMS_DataEarth,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.90,
		tileSize : new google.maps.Size(256, 256)
	};
	wmsDataEarth = new google.maps.ImageMapType(wmsOptions_DataEarth);

	var wmsOptions_MRT_project = {
		alt : "MapServer Layer",
		getTileUrl : WMS_MRT_project,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_MRT_project = new google.maps.ImageMapType(wmsOptions_MRT_project);

	var wmsOptions_newdma = {
		alt : "MapServer Layer",
		getTileUrl : WMS_newdma,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.70,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_newdma = new google.maps.ImageMapType(wmsOptions_newdma);
	
	var wmsOptions_Pipe_in_Plan = {
		alt : "MapServer Layer",
		getTileUrl : WMS_Pipe_in_Plan,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,

		tileSize : new google.maps.Size(256, 256)
	};
	wms_Pipe_in_Plan = new google.maps.ImageMapType(wmsOptions_Pipe_in_Plan);
	
	var wmsOptions_wlma_status = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_status,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.70,
		tileSize : new google.maps.Size(256, 256)
	};
	wlma_status = new google.maps.ImageMapType(wmsOptions_wlma_status);
	
	var wmsOptions_servicearea = {
		alt : "MapServer Layer",
		getTileUrl : WMS_servicearea,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.70,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_servicearea = new google.maps.ImageMapType(wmsOptions_servicearea);
	
	var wmsOptions_well = {
		alt : "MapServer Layer",
		getTileUrl : WMS_well,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_well = new google.maps.ImageMapType(wmsOptions_well);
	
	var wmsOptions_project9 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_project9,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_project9 = new google.maps.ImageMapType(wmsOptions_project9);
	
	var wmsOptions_police = {
		alt : "MapServer Layer",
		getTileUrl : WMS_police,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.5,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_police = new google.maps.ImageMapType(wmsOptions_police);
	
	var wmsOptions_electricityPipe = {
		alt : "MapServer Layer",
		getTileUrl : WMS_electricityPipe,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.8,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_electricityPipe = new google.maps.ImageMapType(wmsOptions_electricityPipe);
	
	var wmsOptions_Pipe_line_age_15_to_25 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Pipe_line_age_15_to_25,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 0.8,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_Pipe_line_age_15_to_25 = new google.maps.ImageMapType(wmsOptions_Pipe_line_age_15_to_25);
	
	var wmsOptions_Main_Pipe_age_15_to_25 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Main_Pipe_age_15_to_25,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 0.8,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_Main_Pipe_age_15_to_25 = new google.maps.ImageMapType(wmsOptions_Main_Pipe_age_15_to_25);
	
	var wmsOptions_distribution_pipe_age_15_to_25 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_distribution_pipe_age_15_to_25,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_distribution_pipe_age_15_to_25 = new google.maps.ImageMapType(wmsOptions_distribution_pipe_age_15_to_25);
	
	var wmsOptions_pipe_AC_age_15_to_25 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_pipe_AC_age_15_to_25,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_pipe_AC_age_15_to_25 = new google.maps.ImageMapType(wmsOptions_pipe_AC_age_15_to_25);
	
	var wmsOptions_pipe_line_age_25_to_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_pipe_line_age_25_to_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_pipe_line_age_25_to_30 = new google.maps.ImageMapType(wmsOptions_pipe_line_age_25_to_30);
	
	var wmsOptions_Main_pipe_age_25_to_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Main_pipe_age_25_to_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_Main_pipe_age_25_to_30 = new google.maps.ImageMapType(wmsOptions_Main_pipe_age_25_to_30);
	
	var wmsOptions_distribution_pipe_age_25_to_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_distribution_pipe_age_25_to_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_distribution_pipe_age_25_to_30 = new google.maps.ImageMapType(wmsOptions_distribution_pipe_age_25_to_30);
	
	var wmsOptions_pipe_ac_age_25_to_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_pipe_ac_age_25_to_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_pipe_ac_age_25_to_30 = new google.maps.ImageMapType(wmsOptions_pipe_ac_age_25_to_30);
	
	var wmsOptions_pipe_line_age_over_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_pipe_line_age_over_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_pipe_line_age_over_30 = new google.maps.ImageMapType(wmsOptions_pipe_line_age_over_30);
	
	var wmsOptions_Main_pipe_age_over_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_Main_pipe_age_over_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_Main_pipe_age_over_30 = new google.maps.ImageMapType(wmsOptions_Main_pipe_age_over_30);
	
	var wmsOptions_distribution_pipe_age_over_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_distribution_pipe_age_over_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_distribution_pipe_age_over_30 = new google.maps.ImageMapType(wmsOptions_distribution_pipe_age_over_30);
	
	var wmsOptions_pipe_ac_age_over_30 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_pipe_ac_age_over_30,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_pipe_ac_age_over_30 = new google.maps.ImageMapType(wmsOptions_pipe_ac_age_over_30);
	
	var wmsOptions_tunnel_originel = {
			alt : "MapServer Layer",
			getTileUrl : WMS_tunnel_originel,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_tunnel_originel = new google.maps.ImageMapType(wmsOptions_tunnel_originel);
	
	var wmsOptions_main_pipe_originel = {
			alt : "MapServer Layer",
			getTileUrl : WMS_main_pipe_originel,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_main_pipe_originel = new google.maps.ImageMapType(wmsOptions_main_pipe_originel);
	
	var wmsOptions_distribution_pipe = {
			alt : "MapServer Layer",
			getTileUrl : WMS_distribution_pipe,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,		
			tileSize : new google.maps.Size(256, 256)
		};
	wms_distribution_pipe = new google.maps.ImageMapType(wmsOptions_distribution_pipe);
	
	var wmsOptions_LUP_2556 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_LUP_2556,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 0.6,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_lup_2556 = new google.maps.ImageMapType(wmsOptions_LUP_2556);
	
	var wmsOptions_region = {
			alt : "MapServer Layer",
			getTileUrl : WMS_region,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 0.8,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_region = new google.maps.ImageMapType(wmsOptions_region);
	
	var wmsOptions_water_praya = {
			alt : "MapServer Layer",
			getTileUrl : WMS_water_praya,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 0.8,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_water_praya = new google.maps.ImageMapType(wmsOptions_water_praya);
	var wmsOptions_stolenmeter_2014_08 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_stolenmeter_2014_08,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 1,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_stolenmeter_2014_08 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2014_08);
	var wmsOptions_stolenmeter_2014_09 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_stolenmeter_2014_09,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 1,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_stolenmeter_2014_09 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2014_09);
	var wmsOptions_stolenmeter_2014_10 = {
			alt : "MapServer Layer",
			getTileUrl : WMS_stolenmeter_2014_10,
			isPng : false,
			maxZoom : 17,
			minZoom : 1,
			opacity : 1,
			tileSize : new google.maps.Size(256, 256)
		};
	wms_stolenmeter_2014_10 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2014_10);
	var wmsOptions_stolenmeter_2014_11 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2014_11,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2014_11 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2014_11);
	var wmsOptions_stolenmeter_2014_12 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2014_12,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2014_12 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2014_12);
	var wmsOptions_stolenmeter_2015_01 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2015_01,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2015_01 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2015_01);
        
        var wmsOptions_stolenmeter_2015_02 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2015_02,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2015_02 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2015_02);
        var wmsOptions_stolenmeter_2015_03 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2015_03,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2015_03 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2015_03);
        var wmsOptions_stolenmeter_2015_04 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2015_04,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2015_04 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2015_04);
        var wmsOptions_stolenmeter_2015_05 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2015_05,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2015_05 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2015_05);
        var wmsOptions_stolenmeter_2015_06 = {
		alt : "MapServer Layer",
		getTileUrl : WMS_stolenmeter_2015_06,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_stolenmeter_2015_06 = new google.maps.ImageMapType(wmsOptions_stolenmeter_2015_06);
        
        var wmsOptions_wlma_NFA_Alert = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_NFA_Alert,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_NFA_Alert = new google.maps.ImageMapType(wmsOptions_wlma_NFA_Alert);
        
        var wmsOptions_wlma_p_wl = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_p_wl,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.6435,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_p_wl = new google.maps.ImageMapType(wmsOptions_wlma_p_wl);
        var wmsOptions_gps_av = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_gps_av,
		isPng : false,
		maxZoom : 17,
		minZoom : 0.654,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_gps_av = new google.maps.ImageMapType(wmsOptions_gps_av);
        var wmsOptions_branches = {
		alt : "MapServer Layer",
		getTileUrl : WMS_branches,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 1,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_branches = new google.maps.ImageMapType(wmsOptions_branches);
        var wmsOptions_Rtu_Status = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_RTU_Status,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_RTU_Status = new google.maps.ImageMapType(wmsOptions_Rtu_Status);
        var wmsOptions_DMA_LAST = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_DMA_LAST,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_DMA_LAST = new google.maps.ImageMapType(wmsOptions_DMA_LAST);
        var wmsOptions_DMA_YEAR = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_DMA_YEAR,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_DMA_YEAR = new google.maps.ImageMapType(wmsOptions_DMA_YEAR);
        var wmsOptions_P_AVG = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_P_AVG,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_P_AVG = new google.maps.ImageMapType(wmsOptions_P_AVG);
        var wmsOptions_LAST_LD = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_LAST_LD,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_LAST_LD = new google.maps.ImageMapType(wmsOptions_LAST_LD);
        var wmsOptions_LAST_LR = {
		alt : "MapServer Layer",
		getTileUrl : WMS_wlma_LAST_LR,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	wms_wlma_LAST_LR = new google.maps.ImageMapType(wmsOptions_LAST_LR);
         var wmsOptions_LandUse = {
		alt : "MapServer Layer",
		getTileUrl : WMS_LandUse,
		isPng : false,
		maxZoom : 17,
		minZoom : 1,
		opacity : 0.654,
		tileSize : new google.maps.Size(256, 256)
	};
	landuse = new google.maps.ImageMapType(wmsOptions_LandUse);
        
	// เพื่อเรียก overlay WMS
        //ชื่อตรงกับ value ใน checkbox map.php
	//name ต้องชื่อตรงกับ array WMSlink ใน identify.js
	//obj คือ wms ที่ประกาศข้างบน
	wmslayers = {
		"Pipe_in_Plan" : {name : "Pipe_in_Plan", obj : wms_Pipe_in_Plan},
		"servicearea" : {name : "servicearea", obj : wms_servicearea},
		"police" : {name : "police", obj : wms_police},
		"Customers_in_DMA" : {name : "Customers_in_DMA", obj : wmsCustomers_in_DMA},
		"Valve_in_DMA" : {name : "Valve_in_DMA", obj : wmsValve_in_DMA},
		"Trunkmain_leak_DMA" : {name : "Trunkmain_leak_DMA", obj : wmsTrunkmain_leak_DMA},
		"repeatedFlood" : {name : "repeatedFlood", obj : wmsRepeatedFlood},
		"repeatedDrought" : {name : "repeatedDrought", obj : wmsRepeatedDrought},
		"River-basin" : {name : "River-basin", obj : wmsRiverBasin},
		"DataEarth" : {name : "DataEarth", obj : wmsDataEarth},
		"well" : {name : "well", obj : wms_well},
		"MRT_project" : {name : "MRT_project", obj : wms_MRT_project},
		"newdma" : {name : "newdma", obj : wms_newdma},
		"project9" : {name : "project9", obj : wms_project9},
		"waterquality" : {name : "waterquality", obj : wms_waterquality},
		"resource" : {name : "resource ", obj : wms_resource},
		"effectivearea" : {name : "effectivearea", obj : wms_effectivearea},
		"electricityPipe" : {name : "electricityPipe", obj : wms_electricityPipe},
		"water_praya" : {name : "water_praya ", obj : wms_water_praya},		
                "branches" : {name : "branches", obj : wms_branches},
		"wlma_status" : {name : "wlma_status", obj : wlma_status},
                "wlma_NFA_Alert" : {name : "wlma_NFA_Alert", obj : wms_wlma_NFA_Alert},
                "wlma_p_wl" : {name : "wlma_p_wl", obj : wms_wlma_p_wl},
                "wlma_gps_av" : {name : "wlma_gps_av", obj : wms_wlma_gps_av},
                "wlma_RTU_Status" : {name : "wlma_RTU_Status", obj : wms_wlma_RTU_Status},
                "wlma_DMA_LAST" : {name : "wlma_DMA_LAST", obj : wms_wlma_DMA_LAST},
                "wlma_DMA_YEAR" : {name : "wlma_DMA_YEAR", obj : wms_wlma_DMA_YEAR},
                "wlma_P_AVG" : {name : "wlma_P_AVG", obj : wms_wlma_P_AVG},
                "wlma_LAST_LD" : {name : "wlma_LAST_LD", obj : wms_wlma_LAST_LD},
                "wlma_LAST_LR" : {name : "wlma_LAST_LR", obj : wms_wlma_LAST_LR},
                "landuse" : {name : "landuse", obj : landuse},
                 "wms_crm1" : {name : "wms_crm1", obj : wms_crm1},
                 "wms_crm2" : {name : "wms_crm2", obj : wms_crm2},
                 "wms_crm3" : {name : "wms_crm3", obj : wms_crm3},
                 "wms_crm4" : {name : "wms_crm4", obj : wms_crm4}
                
	};
}
///////////////////////////////////////////////////// Functions /////////////////////////////////////////////
function WMS_crm1(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/service_for_latlng/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "4";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_crm2(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/service_for_latlng/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "3";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_crm3(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/service_for_latlng/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "2";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_crm4(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/service_for_latlng/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "1";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
//Tunnel_chainat, intersect_stream, intersect_mainriver
function WMS_water_praya(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "29,30,31";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_LandUse(tile, zoom) { //การใช้ประโยชน์ที่ดิน
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/future/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "1,2,3";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
//พิกัดประตูน้ำท่อประธาน เฟส 1-2
function WMS_region(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "5,6";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
//เปอร์เซ็นต์น้ำสูญเสียในเดือนที่ผ่านมา
function WMS_wlma_p_wl(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "7,8";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}

function WMS_LUP_2556(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/future/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "0";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
//DistributionPipe
function WMS_distribution_pipe(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "1";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
//MainPipe_original
function WMS_main_pipe_originel(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "0";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
//Tunnel_original
function WMS_tunnel_originel(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "2";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}

function WMS_pipe_ac_age_over_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "8";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_distribution_pipe_age_over_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "12";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Main_pipe_age_over_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "16";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_pipe_line_age_over_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "20";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_pipe_ac_age_25_to_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "9";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_distribution_pipe_age_25_to_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "13";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Main_pipe_age_25_to_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "17";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_pipe_line_age_25_to_30(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "21";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_pipe_AC_age_15_to_25(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "10";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_distribution_pipe_age_15_to_25(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "14";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Main_Pipe_age_15_to_25(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "18";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Pipe_line_age_15_to_25(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "22";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Pipe_AC_age_15(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "11";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Pipeline_age_15(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "23";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "default";
	var url = wmsproxy +baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);  
	return url;
}
function WMS_Main_pipe_age_15(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "19";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "default";
	var url = wmsproxy +baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function WMS_distribution_pipe_age_15(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "15";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "default";
	var url = wmsproxy +baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function WMS_waterquality(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://iwis.pcd.go.th/cgi-bin/pcd_wms?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station,";
	var layers = "auto_station,wqi_station,auto_station_label";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "default";
	var url = baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
//พื้นที่ผลกระทบเนื่องจากการปิดน้ำ
function wms_effectivearea(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/effective_area/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "0,1";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(ul, lr, tile, zpow);
	return url;
}
function WMS_resource(tile, zoom) {
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://wms2.dmr.go.th/cgi-bin/dmr_wms/gisdmr_wms?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "OGC_WMS";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
//จำนวนผู้ใช้น้ไใน DMA
function WMS_Customers_in_DMA(tile, zoom) { // แผนที่สถิติ ผู้ใช้น้ำ ในขอบ DMA
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "9";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
//จำนวนประตูน้ำใน DMA
function WMS_Valve_in_DMA(tile, zoom) { // แผนที่สถิติ ประตูน้ำ ในขอบ DMA
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84

	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "8";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
//จำนวนจุดแตกรั่วท่อประธาน
function WMS_Trunkmain_leak_DMA(tile, zoom) { 	// แผนที่สถิติจุดแตกรั่วท่อประธานในขอบ DMA
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in
	// ArcMap
	// var layers = "wqi_station";
	var layers = "7";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log("Trunkmain_leak_DMA",url);
	return url;
}
function WMS_RepeatedFlood(tile, zoom) { // แผนที่พื้นที่น้ำท่วมซ้ำซาก
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84

	var baseURL = "http://172.16.195.26/arcgis/services/dss/Water_resource/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "6";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
function WMS_RepeatedDrought(tile, zoom) { // แผนที่พื้นที่แห้งแล้งซ้ำซาก
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Water_resource/MapServer/WMSServer?";																							
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "5";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
function WMS_RiverBasin(tile, zoom) { // แผนที่ลุ่มน้ำในประเทศไทย
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Water_resource/MapServer/WMSServer?"; 																									
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "4";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
function WMS_DataEarth(tile, zoom) { // แผนที่ข้อมูลชุดดิน
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Water_resource/MapServer/WMSServer?"; 
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "1,2,3";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
function WMS_MRT_project(tile, zoom) { // แผนที่เส้นทางรถไฟฟ้า
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/future/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "6";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	// console.log(url);
	return url;
}
function WMS_newdma(tile, zoom) { // แผนที่ขอบเขตสาขาในอนาคต
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/future/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "5";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	return url;
}
function WMS_Pipe_in_Plan(tile, zoom) { // แผนที่ท่อประธานที่อยู่ระหว่างการก่อสร้าง
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "24";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	return url;
}
//สถานะ Active 
function WMS_wlma_status(tile, zoom) { // แผนที่เปอร์เซ็นน้ำสูญเสียราย DMA ทุกกสาขา
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "9";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
        //console.log(url);
	return url;
}
//พื้นที่บริการ พื้นที่จำหน่ายน้ำ
function WMS_servicearea(tile, zoom) { // แผนที่เปอร์เซ็นน้ำสูญเสียราย DMA ทุกกสาขา
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "6";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	return url;
}

function  WMS_stolenmeter_2014_08(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "14";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}

function  WMS_stolenmeter_2014_09(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "15";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2014_12(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "18";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2015_01(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "17";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2015_02(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "16";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2015_03(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "15";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2015_04(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "14";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2015_05(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "13";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_stolenmeter_2015_06(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "12";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function WMS_well(tile, zoom) { // ตำแหน่งมาตรวัดน้ำหาย เดือน กันยายน 2556
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Water_resource/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "7,8,9,10";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_project9(tile, zoom) { // ตำแหน่งมาตรวัดน้ำหาย เดือน กันยายน 2556
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/future/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "7,8";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}

function  WMS_stolenmeter_2014_10(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "16";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}

function  WMS_stolenmeter_2014_11(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "17";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
function  WMS_police(tile, zoom) { // ตำแหน่งมาตรวัดน้ำหาย เดือน กันยายน 2556
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "5";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//DuctDimension_WGS84, DuctBank_WGS84, Manhole_WGS84, V_Pole_WGS84
function  WMS_electricityPipe(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "25,26,27,28";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//gps_av
function  WMS_wlma_gps_av(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/engineer/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "4";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//พื้นที่รับผิดชอบของสาขา
function  WMS_branches(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/Service/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "10";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//สถานะ Minimum Night Flow Alert
function  WMS_wlma_NFA_Alert(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "6";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//ความพร้อมของ RTU
function  WMS_wlma_RTU_Status(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "5";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//DMA เป้าหมายของเดือน
function  WMS_wlma_DMA_LAST(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "4";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//จำนวนครั้งที่ได้เป็น DMA เป้าหมายในรอบปี 
function  WMS_wlma_DMA_YEAR(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "3";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//แรงดันน้ำเฉลี่ย On Peak  
function  WMS_wlma_P_AVG(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "2";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//จำนวนงานสำรวจท่อรั่ว  
function  WMS_wlma_LAST_LD(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "1";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}
//จำนวนงานซ่อมท่อ
function  WMS_wlma_LAST_LR(tile, zoom) { 
	var projection = window.map.getProjection();
	var zpow = Math.pow(2, zoom);
	var ul = new google.maps.Point(tile.x * 256.0 / zpow, (tile.y + 1) * 256.0
			/ zpow);
	var lr = new google.maps.Point((tile.x + 1) * 256.0 / zpow, (tile.y)
			* 256.0 / zpow);
	var ulw = projection.fromPointToLatLng(ul);
	var lrw = projection.fromPointToLatLng(lr);
	// The user will enter the address to the public WMS layer here. The data
	// must be in WGS84 
	var baseURL = "http://172.16.195.26/arcgis/services/dss/WLMA/MapServer/WMSServer?";
	var version = "1.1.1";
	var request = "GetMap";
	var format = "image/png"; // type of image returned
	// The layer ID. Can be found when using the layers properties tool in ArcMap
	var layers = "0";
	var srs = "EPSG:4326"; // projection to display. This is the projection of
							// google map. Don't change unless you know what you
							// are doing.
	var bbox = ulw.lng() + "," + ulw.lat() + "," + lrw.lng() + "," + lrw.lat();
	// Add the components of the URL together
	var width = "256";
	var height = "256";
	var styles = "";
	var url = wmsproxy + baseURL + "version=" + version + "&request=" + request
			+ "&Layers=" + layers + "&Styles=" + styles + "&SRS=" + srs
			+ "&BBOX=" + bbox + "&width=" + width + "&height=" + height
			+ "&format=" + format + "&TRANSPARENT=TRUE";
	//console.log(url);
	return url;
}

